package jvmtest;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: Tom
 * @Date: 2022/01/18/10:54
 * @Description:
 */

/**
 *@ClassName JavaVMStackOOM
 *@Description
 *@Author 王琛
 *@Date 2022/1/18 10:54
 @Version 1.0
 */
public class JavaVMStackOOM {
    private void dontStop(){
        while (true) {
        }
    }
    public void stackLeakByThread(){
        while (true) {
            Thread thread = new Thread(new Runnable() {

                @Override
                public void run() {
                    dontStop();
                }
            });
            thread.start();
        }
    }

    public static void main(String[] args) {
        JavaVMStackOOM oom = new JavaVMStackOOM();
        oom.stackLeakByThread();
    }

}
